home *** CD-ROM | disk | FTP | other *** search
- Path: service-2.agate.net!usenet
- From: andle@biode.com (Jeffrey C. Andle)
- Newsgroups: comp.lang.c++
- Subject: Complex class appears to be completely missing in VC4.0?
- Date: 9 Jan 1996 02:38:01 GMT
- Organization: Biode, Inc.
- Message-ID: <4cske9$64m@service-2.agate.net>
- NNTP-Posting-Host: biode.sdi.agate.net
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.11
-
- All right, the BS I've seen with Complex classes in early Borland
- and MS compilers is one thing (functions defined but not implemented,
- etc.), but it appears to be completely gone from VC 4.0.
-
- I own Watcom 10.0 and 10.5beta, but can't seen to get their library
- & header to run with VC. Is there a "standard" C++ complex class
- that is generally available or do I buy the CRC math handbook & wing
- it with Taylor series for the trig & pow() functions, etc?
-
-
-
-
-
-
- As a side question, when should a function / operator be:
-
- ..... Complex & operator foo ()
-
-
- vs.
-
-
- ..... Complex operator foo ()
-
- ?
-
-
-
-
- the former bombed when I wrote:
-
- // Unary - as friend:
- Complex& operator- (Complex& Z);
-
- // Binary - as member:
- Complex& Complex::operator- (Complex& Z);
-
- // e to a complex number using dexp, sin, cos:
- Complex& Exp(Complex &Z);
-
- // division by a long as a member function:
- Complex& Complex::operator/ (double r);
-
- then used this function:
-
- Complex& Sinh(Complex &Z)
- {
- return ((Exp(Z) - Exp(-Z))/2.);
- };
-
-
- tracing through the code, each step worked except the binary -,
- which apparently subtracted an address from a complex! Bug or coding
- error?
-
- Of course, the second approach gave me a slew of "nonstandard extension:
- initializing" warnings when assigning:
-
- Complex Exp(Complex Y);
- Complex Y = Complex(1., 0.);
-
- Complex Z = Exp(Y); // warning!
-
- any help at all would be appreciated.
- please e-mail to andle@agate.net (ignore biode.com, as the server is
- having molten silicon problems... (;-<<<)
-
-